<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>订单表列表</title>
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1.0" />
    <#include "/view/admin/head.html"/>
    <script type="text/javascript" src="${base}/jstool/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
    <script type="text/javascript" src="${base}/jstool/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
    <link rel="stylesheet" type="text/css" href="${base}/jstool/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" />
    <script type="text/javascript" src="${base}/jstool/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
    <script type="text/javascript" src="${base}/jstool/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
    <link rel="stylesheet" type="text/css" href="${base}/jstool/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" />
    <script type="text/javascript" src="${base}/jstool/bootstrap-select/js/bootstrap-select.min.js"></script>
    <script type="text/javascript" src="${base}/jstool/bootstrap-select/lang/defaults-zh_CN.min.js"></script>
    <link rel="stylesheet" type="text/css" href="${base}/jstool/bootstrap-select/css/bootstrap-select.min.css" />

    <style type="text/css">
        .table-class{
            width:90%;
            text-align: center;
            border:1px solid #afd9ee;
            margin:0 auto;
            margin-top: 50px;
        }
        .list-path{
            height: 50px;
            line-height: 50px;
            background-color: #9acfea;

        }
        table th{
            text-align: center;
            WORD-WRAP: break-word;
            width: 100px;
        }
        table thead tr {
            background-color: #9acfea;
        }
        .table-query{
            /*height: 40px;*/
            /*width:80px;*/
            /*text-align: center;*/
            white-space:nowrap;
            /*position: relative;*/
            float: left;
            display:inherit;
            /*display: inline;*/


        }
        .label-head{
            height: 60px;
            width: 100%;
        }
        .bs-example .input-group{
            width:300px;
            float: left;
            margin-top:20px;

        }
        .bank-label{
            width:25px;
            float: left;
        }
        .label-hidden{
            display: none;
        }
        .panel-body{
            padding-top: 0px;
        }
        .input-group input[type='text']{
            z-index: inherit;
        }
       /* .input-group{
            margin-top:20px;
        }*/
    </style>
    <script type="text/javascript">
        function query(dm){
            var href = "${base}/businorder/list?";

            href+='orderCode='+$('#orderCode').val();
                    href+='&'


            href+='businessId='+$('#businessId').val();
                    href+='&'

        	  href+='phoneNo='+$('#phoneNo').val();
        			href+='&'

            href+='status='+$('#status').val();
                    href+='&'

            href+='createTimeStart='+$('#createTimeStart').val()+"&";
            href+='createTimeEnd='+$('#createTimeEnd').val();
                 
            location.href=href;
        }
        $(function() {
            //初始化
             /*    $('#createTimeStart').datetimepicker();
                $('#createTimeEnd').datetimepicker(); */
                
                $('#createTimeStart').datetimepicker({

                	　　language: 'zh-CN',
                	　　autoclose: true,
                	　　todayHighlight: true
                	});
                  $('#createTimeEnd').datetimepicker({

                	　　language: 'zh-CN',
                	　　autoclose: true,
                	　　todayHighlight: true
                	});
                
        });
    </script>
</head>
<body>

	<#include "/view/admin/listnav.html"/>

<div class="table-class">

    <div class="panel panel-default" style="margin: 10px 50px 10px;">
     <div class="panel-body">
        <form class="bs-example bs-example-form" role="form">
				
				    <div class="input-group">
                <span class="input-group-addon">订单编号</span>
                <input type="text" id="orderCode" class="form-control" value="${orderCode!}" placeholder="请输入订单编号">
            </div>
           
                <span class="bank-label">&nbsp;</span>
                  <div class="input-group">
                <span class="input-group-addon">收货人手机号码</span>
                <input type="text" id="phoneNo" class="form-control" value="${phoneNo!}" placeholder="收货人手机号码">
            </div>
            
            <span class="bank-label">&nbsp;</span>
                  <div class="input-group">
                <span class="input-group-addon">订单状态</span>
               	<select name="status" id="status" class="form-control selectpicker"   data-live-search="true">
			  
         			<option value="-1" >请选择</option>
               		<option value="0" <#if status?? && status==0> selected</#if>>待支付</option>
               		<option value="7" <#if status?? && status==7> selected</#if>>待收货</option>
               		<option value="8" <#if status?? && status==8> selected</#if>>已完成</option> 
               		<option value="10" <#if status?? && status==10> selected</#if>>取消订单中</option>
               		<option value="17" <#if status?? && (status==17 || status==19)> selected</#if>>商家已退款</option>
               		<option value="13" <#if status?? && status==13> selected</#if>>待发货</option>
               		<option value="18" <#if status?? && status==18> selected</#if>>退货成功</option>
               	</select>
               
               
            </div>
           
                <span class="bank-label">&nbsp;</span>


                <div class="input-group">
                    <span class="input-group-addon">开始下单时间>=</span>
                    <input type="text" id="createTimeStart" class="form-control" value="" id="createTimeStart" name="createTimeStart" data-date-format="yyyy-mm-dd hh:ii:ss">
                </div>
                <span class="bank-label">&nbsp;</span>
                <div class="input-group">
                    <span class="input-group-addon">结束下单时间<=</span>
                    <input type="text" id="createTimeEnd" class="form-control" value="" name="createTimeEnd" data-date-format="yyyy-mm-dd hh:ii:ss">
                </div>
         
                <span class="bank-label">&nbsp;</span>


            <div class="input-group" style="text-align: right;">
                <a class="btn btn-info"  href="javascript:query(this)"><span class="glyphicon glyphicon-search"></span> 查找</a>

            </div>
           
        </form>
     </div>
    </div>

<#include "/view/admin/opermsg.html"/>


    <table class="table table-hover table-bordered">

        <thead>
        <tr>
            <th>序号</th>
                <th class="label-hidden">主键</th>
                <th>订单编号</th>
                <!-- <!--  <th>购买商品名称</th> -->
                <th>总金额</th>
                <!-- <th>购买数量</th> -->
                <th>订单状态</th>
                 <!-- <th>收货人联系电话</th> -->
                 <th>购买人</th>
                 <th>联系电话</th>
                <th>下单时间</th>

            <th style="width: 20%">操作</th>
        </tr>
        </thead>
        <tbody>
      <#--  <tr>
            <td colspan="9" style="text-align: left;color: red; ">已售量：${allSoldOut?default(0)};
                <span style="width:50px;">&nbsp;</span>
                已售金额：${salesAmount?default("0")}元;
            </td>
        </tr>-->
        <#list pagination.list as c>
            <tr>
                <td>${(pagination.pageNo-1)*pagination.pageSize+1+c_index}</td>
                        <td class="label-hidden">${c.id!}</td>
                      <th>${c.orderCode!}</th>
             <!--    <th>${c.commodityName!}</th> -->
                <th>${c.totalAmount!}</th>
                <!-- <th>${c.amount!}</th> -->
                <th>
                	
                <#if c.status ??>
                	<#if c.status==0> <span class="label label-default">待支付</span></#if>
               		<#if c.status==7> <span class="label label-default">待收货</span></#if>
               		<#if  c.status==8> <span class="label label-success">已完成</span></#if>
               		<#if c.status==10> <span class="label label-warning">取消订单中</span></#if>
               		<#if (c.status==17 ||  c.status==19) ><span class="label label-danger">商家已退款</span></#if>
            	   	<#if c.status==13> <span class="label label-default">待发货</span></#if>
            		  <#if c.status==18> <span class="label label-danger">退货成功</span></#if>
               			<#else>
               		--
               		</#if>
               		
                
                </th>
                 <!-- <th>${c.phoneNo!}</th> -->
                    <th>
                    	<#if c.businOrderUser ?? &&  c.businOrderUser.nickname??>
                    	${c.businOrderUser.nickname!}
                    	</#if>
                    </th>
                 <th>
                 <#if c.businOrderUser ?? &&  c.businOrderUser.telephone??>
                    	${c.businOrderUser.telephone!}
                    	</#if>
                 </th>
                   <td><#if c.createtime?? >${c.createtime?string('yyyy-MM-dd HH:mm:ss')}</#if></td>


                <td>
                <@shiro.hasPermission name="13.2.1"> 
                    <a href="${base}/businorder/detail?id=${c.id!}&businessid=${c.businessid!}" class="btn btn-primary">详情</a>
                </@shiro.hasPermission>
                <#if  c.status==13>
                 <a href="${base}/businorder/getExpress?orderCode=${c.orderCode!}&orderId=${c.id!}" class="btn btn-primary">发货</a>

                 </#if>
                <#if c.status==10>
                    <button type="submit" onclick="refundSuccess('${c.id!}')" id="s_${c.id!}" class="btn btn-success">同意退款</button>
                    <button type="submit" onclick="refused('${c.id!}')" id="r_${c.id!}" class="btn btn-danger">拒绝退款</button>

                </#if>
                <#if c.isRefund??&&c.isRefund==1>
                    <a href="javascript:goods('${c.id!}')" id="${c.id}Refund" class="btn btn-primary">退货退款</a>
                </#if>


                </td>
            </tr>


        </#list>
        <#if 0==pagination.totalCount>
            <tr>
                <td colspan="7" style="color: red"> 没有相关数据 </td>
            </tr>
        </#if>

        </tbody>

    </table>
        <!--<span style="text-align: left"> <a href="#" class="btn btn-primary">新增</a></span>-->
    <#include "/view/admin/pagination.html"/>


</div>
<script>
    function setPage(pageNo,pageSize){
    	 var href = "${base}/businorder/list?";

         href+='orderCode='+$('#orderCode').val();
                 href+='&'


         href+='businessId='+$('#businessId').val();
                 href+='&'

     	  href+='phoneNo='+$('#phoneNo').val();
     			href+='&'

         href+='status='+$('#status').val();
                 href+='&'

         href+='createTimeStart='+$('#createTimeStart').val()+"&";
         href+='createTimeEnd='+$('#createTimeEnd').val();
         href+="&pageNo="+pageNo;
         href+="&pageSize="+pageSize;
         location.href=href;
    }
    function checkDelete(url){
        if (window.confirm("确认删除吗?")) {
            location.href=url;
        }
    }
    function goods(id){
        if (window.confirm("确认同意退款吗?")) {
            $('#' + id+"Refund").attr('disabled', true);
            location.href="${base}/czjrefund/goods.do?orderId="+id;
//            $.get("${base}/czjrefund/goods.do",
//                {orderId:id}, function (data, textStatus){
//                if('success'==textStatus||'SUCCESS'==textStatus){
//                    if(data.status==1){
//                        $('#'+id+'RefundSu').remove();
//                        $('#'+id+'RefundStatus').html('退款成功');
//                    }else{
//                        alert('');
//                    }
//                }else{
//
//                }
//            });
//            location.href="${base}/czjrefund/goods.do?orderId="+id;
        }
    }

    function refundSuccess(id){
        if (window.confirm("确认同意退款吗?")) {
            $('#s_' + id).attr('disabled', true);
            location.href="${base}/czjrefund/success.do?orderId="+id;
        }
    }
    function refused(id){
        if (window.confirm("确认拒绝退款吗?")) {
            $('#r_' + id).attr('disabled', true);
            location.href="${base}/czjrefund/refused.do?orderId="+id;
        }
    }
</script>

</body>
</html>
